import { ConmonDao } from 'src/common.dto';
import { AiProduct } from '../factory/AiProduct';
import request from 'src/utils/request';
import * as UUID from 'uuid';
export class claude2Product implements AiProduct {
  constructor(public conmonDao: ConmonDao) {}
  generateText(conmonDao: ConmonDao): Promise<string> {
    console.log(conmonDao);
    return new Promise((resolve) => {
      // TODO: Implement OpenAI
      resolve('');
    });
  }
  orgId = '';
  async createNewChat() {
    try {
      if (!this.orgId) await this.get_organization_id();
      const response = await request.post(
        `/organizations/${this.orgId}/chat_conversations`,
        {
          uuid: UUID.v4(),
          name: '',
        },
      );
      return response.data;
    } catch (error) {
      return error;
    }
  }
  async get_organization_id() {
    try {
      const orgId = await request.get('/organizations');
      this.orgId = orgId.data[0].uuid;
    } catch (error) {
      return error;
    }
  }
}
